package com.aaa.ssm.controller;

import com.aaa.ssm.entity.Patient;
import com.aaa.ssm.entity.Scheduling;
import com.aaa.ssm.service.SchedulingService;
import com.aaa.ssm.service.impl.SchedulingServiceImpl;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("scheduling")
public class SchedulingController extends BaseController{
    @Resource
    private SchedulingServiceImpl schedulingService;
    @PostMapping("queryByPage")
    @ResponseBody
    public Result queryByPage(@RequestBody Page<Scheduling> page){

        return success(schedulingService.queryByPage(page));
    }
    @GetMapping("queryByParam")
    public Result queryByParam(@RequestBody Scheduling scheduling){
        List<Scheduling> patientList=schedulingService.queryByParam(scheduling);
        return success(patientList);
    }
    @GetMapping("queryById")
    public Result queryById(Integer gtid){
        return success(schedulingService.queryById(gtid));
    }
    @PutMapping("add")
    private Result add(@RequestBody Scheduling scheduling){
        return success(schedulingService.add(scheduling));
    }
    @PutMapping("update")
//    @ResponseBody
    private Result update(@RequestBody Scheduling scheduling){
        return success(schedulingService.update(scheduling));
    }

    @DeleteMapping("delete")
//    @ResponseBody
    private Result delete(Integer gtid){

        return  success(schedulingService.delete(gtid));
    }

}
